﻿package mortal.game.view.friendBless.view.view
{
    import Message.Public.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;

    public class FriendBlessHeadSpr extends GSprite
    {
        private var _headBg:GBitmap;
        private var _headIcon:GImageBitmap;
        private var _vipIcon:GImageBitmap;
        private var _levelBg:ScaleBitmap;
        private var _level:GTextFiled;

        public function FriendBlessHeadSpr()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._headBg = UIFactory.gBitmap(ImagesConst.FriendHeadBg, 0, 0, this);
            this._headIcon = UIFactory.gImageBitmap("", 3, 3, this);
            this._vipIcon = UIFactory.gImageBitmap("", 0, 0, this);
            this._levelBg = UIFactory.bg(-2, 25, 22, 18, this, ImagesConst.LevelBg);
            this._level = UIFactory.gTextField("99", 0, 24, 30, 20, this, GlobalStyle.textFormatBai);
            return;
        }// end function

        public function set data(param1:SMiniPlayer) : void
        {
            this._headIcon.imgUrl = AvatarUtil.getPlayerAvatarUrl(param1.career, param1.sex, AvatarUtil.Small);
            if (param1.VIP > 0 && param1.VIP <= 10)
            {
                this._vipIcon.imgUrl = GameDefConfig.instance.getVipLevelIconUrl(param1.VIP);
            }
            else
            {
                this._vipIcon.imgUrl = "";
            }
            this._level.text = param1.level.toString();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._headBg.dispose();
            this._headIcon.dispose();
            this._vipIcon.dispose();
            this._levelBg.dispose();
            this._level.dispose();
            this._headBg = null;
            this._headIcon = null;
            this._vipIcon = null;
            this._levelBg = null;
            this._level = null;
            return;
        }// end function

    }
}
